<?php
//登录之后的操作

//if($_POST[username],$_POST[password]
$username=$_POST[username];
$password=$_POST[password];
echo $user;
//对Mysql数据库查询
$link=mysql_connect("localhost","root","root") or die("不能连接到数据库服务器！可能是数据库服务器没有启动");
		$db_selected=mysql_select_db("db_ee",$link);
		mysql_query("set names utf8");
		$sql=mysql_query("select * from user where username='$username' and password='$password'",$link);
		if($sql)
		{
			 
				global $user;
				session_start(); 
				session_register(user); 
				$user=$username;
			    //echo $user;
		    header("Content-type:text/html;charset=utf-8");
			//<跳转到初始登录页面>
            echo "<script> alert('恭喜您登录成功'); window.location.href='index.php';</script>";
		}else
		{
			//重新跳转到该页面
			echo "<script> alert('用户名和密码有误，请重新输入'); window.location.href='login.html';</script>";
		}
		//$info=mysql_fetch_array($result);
?>